<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/layout.css" />
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/module_public.css" />
  <script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
  <script type="text/javascript" src="__PUBLIC__/Js/message.js"></script>
</head>
<body>
  <div class="module_public">
     <div class="module_public_content">
        <h1> >> 管理客户 <a href="__ACTION__">【刷新】</a></h1>
     </div>
  <div class="module_public_main">
     <table>
       <tr>
         <td colspan="8"><strong>请选择查询条件 >></strong></td>        
       </tr>
       <tr>
       <td colspan="8"><button class="_button" id="c_name">客户姓名</button>—<button class="_button" id="c_hots">客户热度</button>—<button class="_button" id="c_type">客户种类</button>—<button class="_button" id="c_phase">客户阶段</button>—<button class="_button" id="c_status">客户状态</button>—<button class="_button" id="m_jiazhi">客户价值</button>—<button class="_button" id="m_relation">关系等级</button>—<button class="_button" id="m_credit">客户信用</button></td>
       </tr>
       <tr>
         <td align="center">编号</td>
         <td align="center">客户姓名</td>
         <td align="center">手机号码</td>
         <td align="center">客户热度</td>
         <td align="center">客户种类</td>
         <td align="center">客户阶段</td>
         <td align="center">客户状态</td>
         <td align="center">操作</td>
       </tr>
       <?php if(is_array($c_info)): $k = 0; $__LIST__ = $c_info;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($k % 2 );++$k;?><tr>
         <td align="center"><?php echo ($k); ?></td>
         <td align="center"><?php echo ($v["c_name"]); ?></td>
         <td align="center"><?php echo ($v["c_phone"]); ?></td>
         <?php if($v["c_hots"] == '1'): ?><td align="center">低热</td>
         <?php elseif($v["c_hots"] == '2'): ?>
         <td align="center">中热</td>
         <?php else: ?>
         <td align="center">高热</td><?php endif; ?>
         
         <?php if($v["c_type"] == '1'): ?><td align="center">潜在客户</td>
         <?php elseif($v["c_type"] == '2'): ?>
         <td align="center">普通客户</td>
         <?php elseif($v["c_type"] == '3'): ?>
         <td align="center">VIP客户</td>
         <?php elseif($v["c_type"] == '4'): ?>
         <td align="center">合作伙伴</td>
         <?php else: ?>
         <td align="center">失效客户</td><?php endif; ?>
              
         <?php if($v["c_phase"] == '1'): ?><td align="center">售前跟踪</td>
         <?php elseif($v["c_phase"] == '2'): ?>
         <td align="center">合同执行</td>
         <?php elseif($v["c_phase"] == '3'): ?>
         <td align="center">售后服务</td>
         <?php else: ?>
         <td align="center">合同期满</td><?php endif; ?>

         <?php if($v["c_status"] == '1'): ?><td align="center">已沟通</td>
         <?php elseif($v["c_status"] == '2'): ?>
         <td align="center">已报价</td>
         <?php elseif($v["c_status"] == '3'): ?>
         <td align="center">已做方案</td>
         <?php elseif($v["c_status"] == '4'): ?>
         <td align="center">已签合同</td>
         <?php else: ?>
         <td align="center">已成交</td><?php endif; ?>
         <td align="center">
           <a href="__URL__/look_customerInfo/c_id/<?php echo ($v["c_id"]); ?>">查看/更新客户资料</a> | 
           <a href="__URL__/del_customer/c_id/<?php echo ($v["c_id"]); ?>">删除客户</a>
         </td>
       </tr><?php endforeach; endif; else: echo "" ;endif; ?>
       <tr>
         <td colspan="8" align="right"><?php echo ($fpage); ?></td>
       </tr>
     </table>
  </div>
  <script type="text/javascript">
  $(function(){
	 i = 0;
	 var div_query = $("<input type='button' value='查询' style='width:80px;height:30px;border:1px solid #ccc;margin-left:10px;' id='query_value'/><input type='button' value='取消' style='width:80px;height:30px;border:1px solid #ccc;margin-left:10px;' id='quxiao'/>");
	    
     //客户姓名
     $("#c_name").click(function(){	
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<input type='text' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;' id='value' />");		
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i = 0;	
		});
		
	 });
	 
	 //客户热度
     $("#c_hots").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>低热</option><option value='2'>中热</option><option value='3'>高热</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});
		
	 });
	 
	 
	 //客户种类
     $("#c_type").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>潜在客户</option><option value='2'>普通客户</option><option value='3'>VIP客户</option><option value='4'>合作伙伴</option><option value='5'>失效客户</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});		
	 });
	 
	 
	 //客户阶段
     $("#c_phase").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>售前跟踪</option><option value='2'>合同执行</option><option value='3'>售后服务</option><option value='4'>合同期满</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});		
	 });
	 
	  //客户状态
     $("#c_status").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>已沟通</option><option value='2'>已报价</option><option value='3'>已做方案</option><option value='4'>已签合同</option><option value='5'>已成交</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});		
	 });
	 
	  //客户状态
     $("#m_jiazhi").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>高</option><option value='2'>中</option><option value='3'>低</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});		
	 });
	 
	  //关系等级
     $("#m_relation").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>密切</option><option value='2'>较好</option><option value='3'>一般</option><option value='4'>较差</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});		
	 });
	 
	 
	  //用户信用
     $("#m_credit").click(function(){
	    if(i==0){	
		$(this).siblings().attr("disabled","true");
		var field_name = $(this).attr("id");
		var div_name = $("<select id='value' style='width:100px;height:30px;border:1px solid #ccc;margin-left:10px;'><option value='1'>高</option><option value='2'>中</option><option value='3'>低</option></select>");
		$(this).after(div_query).after(div_name);
		i=1;
		}
		
		$('#query_value').click(function(){
			var v = $("#value").val();
			$.get("__URL__/customer_query",{
				value : v,
				field_name : field_name
			},function(data){
				document.write(data);
			});
		});
		
		$("#quxiao").click(function(){
			$(this).prev().prev().remove();
	    	$(this).prev().remove();
			$(this).remove();
        	$("._button").attr("disabled","");
			i=0;	
		});		
	 });
	 
  });
  
  </script>
  </div>
</body>
</html>